﻿@model BuyerSeller
@{
    ViewBag.Title = "Templates";
}

<h2>Text</h2>

<p>The template binding populates the associated DOM element with the results of rendering a template. Templates are a simple and convenient way to build sophisticated UI structures - possibly with repeating or nested blocks - as a function of your view model data.</p>
<p><a href="http://knockoutjs.com/documentation/template-binding.html" target="_blank">http://knockoutjs.com/documentation/template-binding.html</a></p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.TEMPLATES_VIEW_MODEL, Html.CreateVisiToggler("show the samples view model C# source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))
<br />
@Html.VisiTogglerFromPartial(CodeSamplePartials.TEMPLATES_CONTROLLER, Html.CreateVisiToggler("show the samples controller C# source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))
<br />
@Html.VisiTogglerFromPartial(CodeSamplePartials.TEMPLATES_PERSON_TEMPLATE, Html.CreateVisiToggler("show the person template source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))


@(Html.KoIncludeTemplate<Account>(KnockoutTemplatesPartials.PERSON_TEMPLATE))

<h3>Sample #1</h3>

<h4>Participants</h4>
Here are the participants:

<div @Html.KoAttrTemplate(model => model.Buyer, KnockoutTemplatesPartials.PERSON_TEMPLATE)></div>
<div @Html.KoAttrTemplate(model => model.Seller, KnockoutTemplatesPartials.PERSON_TEMPLATE)></div>

@Html.VisiTogglerFromPartial(CodeSamplePartials.TEMPLATES1, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))


<h3>Sample #2</h3>

<p>Templates with foreach functionality</p>

<div @Html.KoAttrTemplateForeach(model => model.Accounts, KnockoutTemplatesPartials.PERSON_TEMPLATE)></div>

@Html.VisiTogglerFromPartial(CodeSamplePartials.TEMPLATES2, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<br />
<br />
<p>More is coming soon ...</p>

<p>&nbsp;</p>
<p>Next &gt; @Html.ActionLink("File Names Template", "FileNames", "Examples")</p>


@Model.ApplyBindingsScript(KoBindingOptions.IncludeData)


